<?php

require_once('model.php');

class loginmodel extends model
{
  protected $_user;
  protected $_pswd;

  protected $str_uid = "lmuid";
  protected $str_upswd = "lmup";

  public function __construct() {
    $this->restoreLoginModel();
  }

  protected function restoreLoginModel() {
    if (isset($_SESSION[$this->str_uid])) {
      $this->_user = $_SESSION[$this->str_uid];
    } else
      $this->_user = "";
    if (isset($_SESSION[$this->str_upswd])) {
      $this->_pswd = $_SESSION[$this->str_upswd];
    } else
      $this->_pswd = "";
  }

  public function setUser($user) {
    $this->_user = $user;
    $_SESSION[$this->str_uid] = $this->_user;
  }

  public function setPassword($pswd) {
    $this->_pswd = $pswd;
    $_SESSION[$this->str_upswd] = $this->_pswd;
  }

  public function getUser() {
    return $this->_user;
  }

  public function getPassword() {
    return $this->_pswd;
  }

  public function invoke() {
    return True;
  }
}

?>
